#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import kazoo

zk = kazoo.KazooClient(hosts='127.0.0.1:2181')
zk.start(10)

election = zk.Election("/electionpath", "my-identifier")

# blocks until the election is won, then calls
# my_leader_function()
election.run(my_leader_function)